﻿#ifndef TFFLICKVIEWER_H
#define TFFLICKVIEWER_H

#include <QWidget>
#include <QPoint>
#include <QDebug>
#include <QLabel>
#include <QScrollArea>
#include <QResizeEvent>

typedef struct tagItemInfo
{
    QPoint pos;
    QString text;
    QString url;
    QLabel *lb{nullptr};
    tagItemInfo() {}
}ItemInfo;

typedef QList<ItemInfo> ItemList;

class TFFlickViewer : public QWidget
{
    Q_OBJECT
public:
    explicit TFFlickViewer(QWidget *parent = nullptr);

signals:

public slots:
protected:
    void resizeEvent(QResizeEvent *event);
    void wheelEvent(QWheelEvent *);
private:
    void changed();
    void updateLbs();
    void initData(int cnt=20);
    int findMin(const QList<int> &arr);
private:
    bool loadFinshed{false};
    int perCount{3};
    ItemList mItemList;
    QScrollArea *mScrollArea{nullptr};
    QWidget *mBgWidget{nullptr};
};

#endif // TFFLICKVIEWER_H
